<template>
	<div class="app-container own-app-container">
		<el-main>
			<div class="search">
				<el-form ref="searchForm" :inline="true" :model="searchForm" class="form-inline" size="mini">
					<el-form-item label="名称：" prop="name">
						<el-input clearable v-model.trim="searchForm.name" placeholder="请输入名称" />
					</el-form-item>

					<el-form-item>
						<el-button type="primary" plain @click="searchSubmit('searchForm')">搜索</el-button>
						<el-button type="info" plain @click="searchReset">重置</el-button>
					</el-form-item>


				</el-form>
			</div>
			<el-row :gutter="20" type="flex" align="center" class="margin-bottom">
				<el-col>
					<el-button type="primary" size="mini" @click.native="showAdd()">新增
					</el-button>
					<el-button type="primary" size="mini" @click.native="showAlineNumConfirm()">一键校准
					</el-button>
          <!-- <el-button type="primary" size="mini" :disabled="selectRows.length==0"
          	@click.native="exportBuildingMediaPoint()">
          	导出上刊点位
          </el-button> -->
          <el-button type="primary" size="mini" :disabled="selectRows.length==0"
                     @click.native="showSelectWorker()">
            指派工人
          </el-button>
				</el-col>
			</el-row>
			<el-table stripe ref="multipleTable" :data="tableData" tooltip-effect="dark" v-loading="tabLoading"
				style="width: 100%" :row-class-name="tableRowClassName" border @selection-change="handleSelectionChange"
				:default-sort="{prop: 'date', order: 'descending'}" highlight-current-row row-key="id" size="mini"
        :max-height="tableMaxHeight">
				<el-table-column type="selection" width="50" align="center"></el-table-column>
				<el-table-column type="index" label="序号" width="50" align="center">
					<template slot-scope="scope">
						<span>{{ (listParams.page - 1) * listParams.page_size + scope.$index + 1 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="名称" min-width="100" show-overflow-tooltip>
					<template slot-scope="scope">
						<span>{{ scope.row.name }}</span>
						<!-- <el-tag style="margin-left: 5px" type="warning" v-if="scope.row.is_calibration" size="small">可校准
						</el-tag> -->
					</template>
				</el-table-column>
				<el-table-column prop="address" label="地址" min-width="150" show-overflow-tooltip></el-table-column>
				<el-table-column align="center" min-width="220" show-overflow-tooltip
					v-if="(media_types || []).length > 0">
					<template slot="header" slot-scope="scope">
						<span>媒体类型(规格)(<span class="text-green">空闲</span>/总数)</span>
					</template>
					<template slot-scope="scope">
						<div class="flex justify-center align-center flex-direction flex-wrap">
							<div class="flex justify-center align-center flex-direction"
								v-for="(item,index) in (media_types || [])" :key="index"
								v-if="!!scope.row.media_types[''+item.id]">
								<div v-if="value>0" v-for="(value,key) in scope.row.media_types['' + item.id]"
									style="margin: 3px 5px">
									{{ item.name + getMediaTypeSpecName(key) }} ( <span
										class="text-green text-xs">{{ scope.row.free_media_types['' + item.id] !== undefined ? scope.row.free_media_types['' + item.id][key] ? scope.row.free_media_types['' + item.id][key] : 0 : 0 }}
									</span> / <span>{{ value }}</span> )
								</div>
							</div>
							<div v-if="!!scope.row.uninstall_media_types && !!scope.row.uninstall_media_types[''+item.id]"
								v-for="(item, index) in (media_types || [])" :key="id" style="margin: 3px 5px">
								<span :key="index">
									{{ item.name }}(未安装)( <span
										class="text-red text-xs">{{ scope.row.uninstall_media_types['' + item.id] || 0 }}</span>
									)
								</span>
							</div>
						</div>
					</template>
				</el-table-column>

				<el-table-column label="已安装尺寸" width="200" align="center" show-overflow-tooltip>
					<template slot-scope="scope">
						<div class="flex flex-direction justify-start align-center">
							<el-tag v-for="(r,i) in scope.row.point_size" :key="i" type="primary" size="mini"
								class="margin-lr-xs margin-tb-xxs" disable-transitions effect="plain">
								{{ r.media_type }}({{ r.size }}) {{ r.count }}个
							</el-tag>
						</div>
					</template>
				</el-table-column>
        <el-table-column label="指派工人" width="200" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            <div class="flex flex-direction justify-start align-center">
              {{scope.row.worker_names_str}}
            </div>
          </template>
        </el-table-column>
				<el-table-column label="操作" width="420px" align="center" fixed="right">
					<template slot-scope="scope">
						<div class="operation">
							<el-button-group>
								<el-button icon="el-icon-warning-outline" size="mini"
									@click.native="showDetail(scope.row)">详情
								</el-button>
								<el-button type="primary" icon="el-icon-edit-outline" size="mini"
									@click.native="showEdit(scope.row)">编辑
								</el-button>
								<!-- 2022/08/29取消新增录入点位-->
								<!-- <el-tooltip v-if="scope.row.type_id == 84 && scope.row.point_total_count>0" effect="dark"
                            content="大牌类型的项目只能有一个点位" placement="top"
                >
                  <span style="float: left">
                    <el-button type="success" icon="el-icon-edit-outline" size="mini" :disabled="true">录入
                    </el-button>
                  </span>
                </el-tooltip>
                <el-button v-else type="success" icon="el-icon-edit-outline" size="mini"
                           @click.native="showPointAdd(scope.row)"
                >录入
                </el-button>-->
								<!-- <el-button type="warning" icon="el-icon-edit-outline" size="mini" @click.native="submitFile(scope.row)">
                  批量录入
                </el-button> -->
								<el-button type="danger" icon="el-icon-delete" size="mini"
									@click.native="showDel(scope.row.id);">删除
								</el-button>
								<el-button type="primary" icon="el-icon-refresh" size="mini"
									@click.native="showAlineNumConfirm(scope.row.id)">校准
								</el-button>
								<!-- <el-button type="warning" icon="el-icon-map-location" size="mini"
                  @click.native="showMapLocation(scope.row.id,scope.row.address);"
                  v-permission="'add_map_location'" v-if="!scope.row.lat&&!scope.row.lng">添加定位
                </el-button>
                <el-button type="warning" size="mini"
                  @click.native="showNoVotingTimeDialog(scope.row);">设置禁投时间
                </el-button>
                <el-button type="primary" size="mini" @click.native="showNoVotingTimeTable(scope.row)">
                  查看禁投时间
                </el-button> -->
							</el-button-group>
						</div>
					</template>
				</el-table-column>
			</el-table>

			<!-- 分页数据 -->
			<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
				:current-page.sync="current" :page-sizes="[10, 20, 50, 100, 200, 500]" :page-size="listParams.page_size"
				layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
		</el-main>

		<el-dialog :close-on-click-modal="false" :title="(cuForm.id?'编辑':'新增')+'项目'" center :visible.sync="dialogCU"
			width="90%" @close="dialogCUClose('cuForm')">
			<el-form ref="cuForm" v-loading="dialogCULoading" :rules="cuRules" :model="cuForm" size="mini"
				label-width="130px" center>
				<el-divider content-position="left">基本信息</el-divider>
				<el-row :gutter="10">
					<el-col :span="16">
						<el-form-item label="照片">
							<upload-image :curImageProp="cuForm.photo" :ltSizeProp="2" hasDelBtn
								@upload-success="handleUploadImageSuccess" @upload-remove="handleUploadImageRemove">
								<span>不大于2MB</span>
							</upload-image>
						</el-form-item>
						<el-form-item label="分类" prop="type_id">
							<el-col :span="24">
								<el-radio-group v-model="cuForm.type_id" size="mini" @change="changeType">
									<el-radio-button v-for="(item,index) in types" :key="index" :label="item.id">
										{{ item.name }}
									</el-radio-button>
								</el-radio-group>
								<div class="text-xs"><span class="text-bold text-red">大牌</span>或<span
										class="text-bold text-red">大屏</span>，<span
										class="text-bold text-red">1</span>个项目只包含<span
										class="text-bold text-red">1</span>个点位
								</div>
							</el-col>
						</el-form-item>
						<el-form-item label="二级分类" prop="type_id_second"
							v-if="((types_second || new Map()).get(parseInt(cuForm.type_id)) || []).length > 0"
							key="type_id_second">
							<el-col :span="24">
								<el-radio-group v-model="cuForm.type_id_second" size="mini">
									<el-radio-button
										v-for="(item,index) in ((types_second || new Map()).get(parseInt(cuForm.type_id)) || [])"
										:key="index" :label="item.id">{{ item.name }}
									</el-radio-button>
								</el-radio-group>
							</el-col>
						</el-form-item>
						<el-form-item label="名称" prop="name">
							<el-col :span="24">
								<el-input clearable v-model.trim="cuForm.name" placeholder="请输入名称" />
							</el-col>
						</el-form-item>
						<el-form-item label="定位">
							<el-col :span="24">
								<div class="address-search flex justify-start align-center ">
									<el-cascader slot="prepend" v-model="addNewSearchForm.pca" clearable filterable
										placeholder="请选择省市" :options="pcAll" size="mini" class="address-cascader">
									</el-cascader>
									<el-button slot="append" icon="el-icon-search" style="margin-left:10px ;"
										@click.native="searchAddress" size="mini" type="success" plain>搜索位置
									</el-button>
									<span style="font-weight: bold; margin-left: 10px;">{{ cuForm.name }}</span>
									<span style="color: red; margin-left: 10px;"
										v-if="cuForm.lat==null||cuForm.lng==null">(待定位)</span>
									<span style="color: limegreen; margin-left: 10px;"
										v-if="cuForm.lat!=null&&cuForm.lng!=null">(已定位)</span>
								</div>
							</el-col>
						</el-form-item>
						<el-form-item label="地址" prop="address">
							<el-col :span="24">
								<el-input clearable v-model.trim="cuForm.address" placeholder="请输入地址" />
							</el-col>
						</el-form-item>
						<el-form-item label="位置" prop="location_supply">
							<el-col :span="24">
								<el-input type="textarea" clearable :rows="1" placeholder="请输入位置补充说明"
									v-model="cuForm.location_supply" maxlength="200" show-word-limit>
								</el-input>
							</el-col>
						</el-form-item>
					</el-col>
					<el-col :span="8">
						<el-form-item label="禁投行业" prop="forbid_industry_ids">
							<el-col :span="24">
								<el-select clearable filterable multiple v-model="cuForm.forbid_industry_ids"
									placeholder="选择禁止投放行业" style="width:100%">
									<el-option v-for="item in industryList" :key="item.id" :label="item.name"
										:value="item.id" :disabled="!item.status || !!item.deleted_at">
										<span style="float: left">{{ item.name }}</span>
										<span
											:style="{float:'right',color:(!!item.deleted_at?'#e54d42':(!item.status?'#8492a6':'')),fontSize:'12px'}">
											{{ !!item.deleted_at ? '已删除' : (!item.status ? '已禁用' : '') }}</span>
									</el-option>
								</el-select>
							</el-col>
						</el-form-item>
						<el-form-item label="有竞媒" prop="has_compete">
							<el-col :span="24">
								<el-radio-group v-model="cuForm.has_compete">
									<el-radio :label="true">是</el-radio>
									<el-radio :label="false">否</el-radio>
								</el-radio-group>
							</el-col>
						</el-form-item>
						<el-form-item label="地推活动" prop="can_ground_promote">
							<el-col :span="24">
								<el-radio-group v-model="cuForm.can_ground_promote">
									<el-radio :label="true">接受</el-radio>
									<el-radio :label="false">不接受</el-radio>
								</el-radio-group>
							</el-col>
						</el-form-item>
						<el-form-item label="有偿商业宣传" prop="can_paid_ad">
							<el-col :span="24">
								<el-radio-group v-model="cuForm.can_paid_ad">
									<el-radio :label="true">接受</el-radio>
									<el-radio :label="false">不接受</el-radio>
								</el-radio-group>
							</el-col>
						</el-form-item>
						<el-form-item label="车位数" prop="parking_count">
							<el-col :span="24">
								<el-input clearable v-model.trim="cuForm.parking_count" placeholder="请输入车位数" />
							</el-col>
						</el-form-item>
            <el-form-item label="电梯数" prop="elevator_count">
              <el-col :span="24">
                <el-input clearable v-model.trim="cuForm.elevator_count" placeholder="请输入电梯数" />
              </el-col>
            </el-form-item>
            <el-form-item label="电梯类型" prop="elevator_type">
              <el-col :span="24">
                <el-radio-group v-model="cuForm.elevator_type">
                  <el-radio :label="false">单梯</el-radio>
                  <el-radio :label="true">双梯</el-radio>
                </el-radio-group>
              </el-col>
            </el-form-item>
						<el-form-item label="物业费">
							<el-col :span="16">
								<el-input clearable v-model.trim="cuForm.management_fee" placeholder="请输入物业费" />
							</el-col>
							<el-col :span="8">
								<el-select filterable clearable v-model="cuForm.management_fee_unit_id"
									placeholder="请选择物业费单位" style="width:100%">
									<el-option v-for="item in management_fee_unit_ids" :key="item.id" :label="item.name"
										:value="item.id">
									</el-option>
								</el-select>
							</el-col>
						</el-form-item>
						<el-form-item label="受众" prop="audience_ids" v-if="cuForm.type_id==78">
							<el-col :span="24">
								<el-select filterable clearable v-model="cuForm.audience_ids" multiple
									placeholder="请选择受众" style="width:100%">
									<el-option v-for="item in audiences" :key="item.id" :label="item.name"
										:value="item.id">
									</el-option>
								</el-select>
							</el-col>
						</el-form-item>
            <el-form-item label="指派工人" prop="worker_ids">
              <el-col :span="24">
                <el-select filterable clearable v-model="cuForm.worker_ids" multiple
                           placeholder="请选择指派工人" style="width:100%">
                  <el-option v-for="item in workers" :key="item.id" :label="item.name"
                             :value="item.id">
                  </el-option>
                </el-select>
              </el-col>
            </el-form-item>
						<el-form-item label="入住率" prop="occupancy_rate" v-if="cuForm.type_id==78">
							<el-col :span="24">
								<el-input clearable v-model.trim="cuForm.occupancy_rate" type="number"
									placeholder="请输入入住率" max="100.00">
									<template slot="append">%</template>
								</el-input>
							</el-col>
						</el-form-item>
						<el-form-item label="均价" prop="price" v-if="cuForm.type_id==78">
							<el-col :span="24">
								<el-input clearable v-model.trim="cuForm.price" type="number" placeholder="请输入均价(元/平方)">
									<template slot="append">元/平方</template>
								</el-input>
							</el-col>
						</el-form-item>
						<el-form-item label="最高楼层" prop="highest_floor" v-if="cuForm.type_id==78">
							<el-col :span="24">
								<el-input clearable v-model.trim="cuForm.highest_floor" type="number"
									placeholder="请输入最高楼层">
									<template slot="append">层</template>
								</el-input>
							</el-col>
						</el-form-item>
						<el-form-item label="入住年份" prop="check_in_at" v-if="cuForm.type_id==78">
							<el-col :span="24">
								<el-date-picker v-model="cuForm.check_in_at" type="year" placeholder="请选择入住年份"
									value-format="yyyy-MM-dd" style="width:100%">
								</el-date-picker>
							</el-col>
						</el-form-item>
						<el-form-item label="居住规模" prop="scale" v-if="cuForm.type_id==78">
							<el-col :span="24">
								<el-input clearable v-model.trim="cuForm.scale" type="number" placeholder="请输入入住规模">
									<template slot="append">人</template>
								</el-input>
							</el-col>
						</el-form-item>
						<el-form-item label="单次固定售卖" prop="fix_sale_count_per_time" v-if="cuForm.type_id==78">
							<el-col :span="24">
								<el-input clearable v-model.trim="cuForm.fix_sale_count_per_time" type="number" placeholder="请输入单次固定售卖数">
									<template slot="append">个</template>
								</el-input>
							</el-col>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row :gutter="10">
					<el-col :span="16">
						<el-form-item label="覆盖地区" prop="cover_location">
							<el-col :span="24">
								<el-input type="textarea" clearable :rows="1" placeholder="请输入覆盖周边业态/小区/地址"
									v-model="cuForm.cover_location" maxlength="500" show-word-limit>
								</el-input>
							</el-col>
						</el-form-item>
					</el-col>
					<el-col :span="8">
						<el-form-item label="覆盖人群" prop="cover_people_count">
							<el-col :span="24">
								<el-input clearable v-model.trim="cuForm.cover_people_count" type="number"
									placeholder="请输入覆盖周边人口数量">
									<template slot="append">人</template>
								</el-input>
							</el-col>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="备注" prop="remark">
							<el-col :span="24">
								<el-input type="textarea" clearable :rows="2" placeholder="请输入备注"
									v-model="cuForm.remark" maxlength="500" show-word-limit>
								</el-input>
							</el-col>
						</el-form-item>
					</el-col>
				</el-row>
				<el-divider content-position="left">媒体点位数量</el-divider>
				<el-row :gutter="15">
					<el-col :span="12" v-if="(media_types || []).length > 0" v-for="(item,index) in (media_types || []).filter(m => {
            const that = this
            let list = that.type_map.get(cuForm.type_id) || []

            return list.indexOf(m.id)>-1

					})" :key="index">
						<el-form-item :label="item.name+'点位'" :key="item.id">
							<el-col :span="24">
								<el-input-number v-model="cuForm.media_types[''+item.id]" :min="0" :step="1"
									:disabled="!!pointCountInputDisabled" step-strictly controls-positio="right">
								</el-input-number>
							</el-col>
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click.native="dialogCU=false;">取 消</el-button>
				<el-button type="primary" v-if="cuForm.id!=null" @click.native="onSubmit(cuForm.id)">确 定</el-button>
				<el-button v-if="!cuForm.id&&!cuForm.lat" type="danger" disabled>请先定位</el-button>
				<el-button type="primary" v-if="cuForm.id==null&&(!!cuForm.lat&&!!cuForm.lng)"
					@click.native="onSubmit(cuForm.id)">提交</el-button>
			</span>
		</el-dialog>
		<!-- 地址搜索结果弹框 -->
		<el-dialog title="相似地址" :visible.sync="searchDialogVisible" width="60%" center @close="closeSearchDialog">
			<div class="flex-direction justify-start align-center search-dialog">
				<div v-for="item in searchAddresses" :key="item.id"
					class="search-ad-item flex justify-between align-center padding-xs">
					<div>
						<div class="text-black text-bold">
							{{ item.title }}
						</div>
						<div class="text-gray text-xs margin-top-xs">
							{{ item.address }}
						</div>
					</div>
					<div class="flex justify-end align-center">
						<el-button type="text" class="padding-0 text-xs" @click="chooseSearchADItemToAddPoint(item)">
							选择
						</el-button>

					</div>
				</div>
			</div>
		</el-dialog>
		<!-- 普通点位-->
		<el-dialog :close-on-click-modal="false" :title="(pointForm.id?'编辑':'新增')+'录入'" center
			:visible.sync="dialogCommonPoint" width="90%" @close="dialogCUClose('commonPointList')">
			<el-form size="mini" ref="pointForm" v-loading="dialogPointLoading" :model="pointForm" label-width="130px"
				center>
				<el-row type="flex" style="margin-bottom: 20px;">
					<el-button type="primary" @click="addOnePoint('commonInnerVisible')">新增</el-button>
				</el-row>
				<el-table :data="commonPointList" stripe style="width: 100%;" max-height="380" border>
					<el-table-column type="index" label="序号" width="50">
						<template slot-scope="scope">
							<span>{{ scope.$index + 1 }}</span>
						</template>
					</el-table-column>
					<el-table-column prop="code" label="编码" width="120" />
					<el-table-column prop="pic_type_id" label="画面属性" width="150">
						<template slot-scope="scope">
							<div v-for="item in pic_types">
								<div v-if="item.id == scope.row.pic_type_id">
									{{ item.name }}
								</div>
							</div>
						</template>
					</el-table-column>
					<el-table-column v-if="!media_id" prop="media_type_id" label="媒体属性" width="150">
						<template slot-scope="scope">
							<div v-for="item in media_ids">
								<div v-if="item.id == scope.row.media_type_id">
									{{ item.name }}
								</div>
							</div>
						</template>
					</el-table-column>
					<el-table-column prop="size_width" label="对外尺寸_宽(cm)" width="150" />
					<el-table-column prop="size_height" label="对外尺寸_高(cm)" width="150" />
					<el-table-column prop="size_width_inside" label="对内尺寸_宽(cm)" width="150" />
					<el-table-column prop="size_height_inside" label="对内尺寸_高(cm)" width="150" />
					<el-table-column prop="media_type_specs_id" label="规格" width="150">
						<template slot-scope="scope">
							<div v-for="item in media_specs_list">
								<div v-if="item.id == scope.row.media_type_specs_id">
									{{ item.name }}
								</div>
							</div>
						</template>
					</el-table-column>
					<el-table-column prop="location" label="位置" min-width="200" />
					<el-table-column label="操作" width="140">
						<template slot-scope="{row,$index}">
							<el-button type="text" style="color: red;"
								@click.native.prevent="deleteRow($index, commonPointList)">删除
							</el-button>
						</template>
					</el-table-column>
				</el-table>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click.native="dialogCommonPoint=false">取 消</el-button>
				<el-button type="primary" @click.native="onCommonPointSubmit('common')">确 定</el-button>
			</span>
			<!-- 内部新增弹出框-->
			<el-dialog width="80%" title="新增点位" center :visible.sync="commonInnerVisible" append-to-body>
				<el-form size="mini" ref="pointForm" :rules="commonPointRules" :model="pointForm" label-width="150px"
					center>
					<el-row :gutter="10">
						<el-col :span="12">
							<el-form-item label="编号" prop="code">
								<el-col :span="24">
									<el-input clearable v-model.trim="pointForm.code" placeholder="请输入编号" />
								</el-col>
							</el-form-item>
							<el-form-item label="画面属性" prop="pic_type_id">
								<el-select clearable v-model="pointForm.pic_type_id" placeholder="请选择画面属性"
									style="width:100%">
									<el-option v-for="item in pic_types" :key="item.id" :label="item.name"
										:value="item.id">
									</el-option>
								</el-select>
							</el-form-item>
							<el-form-item label="对内尺寸_宽(cm)：" prop="size_width_inside">
								<el-input clearable v-model.trim="pointForm.size_width_inside"
									placeholder="请输入对内尺寸_宽" />
							</el-form-item>

							<el-form-item label="对内尺寸_高(cm)：" prop="size_height_inside">
								<el-input clearable v-model.trim="pointForm.size_height_inside"
									placeholder="请输入对内尺寸_高" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="对外尺寸_宽(cm)" prop="size_width">
								<el-col :span="24">
									<el-input clearable v-model.trim="pointForm.size_width"
										placeholder="请输入对外尺寸_宽(cm)" />
								</el-col>
							</el-form-item>
							<el-form-item label="对外尺寸_高(cm)" prop="size_height">
								<el-col :span="24">
									<el-input clearable v-model.trim="pointForm.size_height"
										placeholder="请输入对外尺寸_高(cm)" />
								</el-col>
							</el-form-item>
							<el-form-item v-if="!media_id" label="媒体类型" prop="media_type_id">
								<el-select clearable v-model="pointForm.media_type_id" placeholder="请选择媒体属性"
									style="width:100%">
									<el-option v-for="item in media_ids" :key="item.id" :label="item.name"
										:value="item.id">
									</el-option>
								</el-select>
							</el-form-item>
							<el-form-item label="规格" prop="media_type_specs_id">
								<el-select clearable v-model="pointForm.media_type_specs_id" placeholder="请选择规格"
									style="width:100%">
									<el-option v-for="item in media_specs_list" :key="item.id" :label="item.name"
										:value="item.id">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
					</el-row>
					<el-form-item label="位置" prop="location">
						<el-col :span="22">
							<el-input type="textarea" :autosize="{ minRows: 4}" placeholder="请输入位置"
								v-model="pointForm.location">
							</el-input>
						</el-col>
					</el-form-item>
				</el-form>
				<span slot="footer" class="dialog-footer">
					<el-button @click.native="cancelAddPoint('commonInnerVisible')">取 消</el-button>
					<el-button type="primary" @click.native="addCommonPoint('commonPoint')">确 定</el-button>
				</span>
			</el-dialog>
		</el-dialog>

		<!--住宅点位录入弹窗-->
		<el-dialog :close-on-click-modal="false" :title="(pointForm.id?'编辑':'新增')+'录入'" center
			:visible.sync="dialogBuildingPoint" width="90%" @close="dialogCUClose('buildingPointList')">
			<el-form size="mini" ref="pointForm" v-loading="dialogPointLoading" :model="pointForm" label-width="120px"
				center>
				<el-row type="flex" style="margin-bottom: 20px;">
					<el-button type="primary" @click="addOnePoint('buildingInnerVisible')">新增</el-button>
				</el-row>
				<el-table :data="buildingPointList" stripe style="width: 100%;" max-height="380" border>
					<el-table-column type="index" label="序号" width="50">
						<template slot-scope="scope">
							<span>{{ scope.$index + 1 }}</span>
						</template>
					</el-table-column>
					<el-table-column prop="code" label="编码" width="120" />
					<el-table-column prop="pic_type_id" label="画面属性" width="150">
						<template slot-scope="scope">
							<div v-for="item in pic_types">
								<div v-if="item.id == scope.row.pic_type_id">
									{{ item.name }}
								</div>
							</div>
						</template>
					</el-table-column>
					<el-table-column prop="building_type" label="楼层类型" width="120">
						<template slot-scope="scope">
							<div v-if="scope.row.building_type===1">多层</div>
							<div v-if="scope.row.building_type===2">高层</div>
						</template>
					</el-table-column>
					<el-table-column prop="building_number" label="楼号" width="120" />
					<el-table-column prop="floor" label="层数" width="120" />
					<el-table-column prop="unit_number" label="单元号" width="120" />
					<el-table-column prop="size_width" label="尺寸_宽(cm)" width="150" />
					<el-table-column prop="size_height" label="尺寸_高(cm)" width="150" />
					<el-table-column prop="size_width_inside" label="对内尺寸_宽(cm)" width="150" />
					<el-table-column prop="size_height_inside" label="对内尺寸_高(cm)" width="150" />
					<el-table-column prop="media_type_specs_id" label="规格" width="150">
						<template slot-scope="scope">
							<div v-for="item in media_specs_list">
								<div v-if="item.id == scope.row.media_type_specs_id">
									{{ item.name }}
								</div>
							</div>
						</template>
					</el-table-column>
					<el-table-column prop="location" label="位置" min-width="200" />
					<el-table-column label="操作" width="140">
						<template slot-scope="{row,$index}">
							<el-button type="text" style="color: red;"
								@click.native.prevent="deleteRow($index, buildingPointList)">删除
							</el-button>
						</template>
					</el-table-column>
				</el-table>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click.native="dialogBuildingPoint=false">取 消</el-button>
				<el-button type="primary" @click.native="onCommonPointSubmit('building')">确 定</el-button>
			</span>
			<!-- 内部新增弹出框-->
			<el-dialog width="80%" title="新增点位" center :visible.sync="buildingInnerVisible" append-to-body>
				<el-form size="mini" ref="pointForm" :rules="commonPointRules" :model="pointForm" label-width="150px"
					center>
					<el-row :gutter="10">
						<el-col :span="12">
							<el-form-item label="编号" prop="code">
								<el-col :span="24">
									<el-input clearable v-model.trim="pointForm.code" placeholder="请输入编号" />
								</el-col>
							</el-form-item>
							<el-form-item label="画面属性" prop="pic_type_id">
								<el-select clearable v-model="pointForm.pic_type_id" placeholder="请选择画面属性"
									style="width:100%">
									<el-option v-for="item in pic_types" :key="item.id" :label="item.name"
										:value="item.id">
									</el-option>
								</el-select>
							</el-form-item>
							<el-form-item label="楼层类型" prop="building_type">
								<el-select clearable v-model="pointForm.building_type" placeholder="请选择楼层类型"
									style="width:100%">
									<el-option v-for="item in building_types" :key="item.id" :label="item.name"
										:value="item.id">
									</el-option>
								</el-select>
							</el-form-item>
							<el-form-item label="单元号" prop="unit_number">
								<el-col :span="24">
									<el-input clearable v-model.trim="pointForm.unit_number" placeholder="请输入单元号" />
								</el-col>
							</el-form-item>
							<el-form-item label="对内尺寸_宽(cm)：" prop="size_width_inside">
								<el-input clearable v-model.trim="pointForm.size_width_inside"
									placeholder="请输入对内尺寸_宽" />
							</el-form-item>

							<el-form-item label="对内尺寸_高(cm)：" prop="size_height_inside">
								<el-input clearable v-model.trim="pointForm.size_height_inside"
									placeholder="请输入对内尺寸_高" />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="对外尺寸_宽(cm)" prop="size_width">
								<el-col :span="24">
									<el-input clearable v-model.trim="pointForm.size_width"
										placeholder="请输入对外尺寸_宽(cm)" />
								</el-col>
							</el-form-item>
							<el-form-item label="对外尺寸_高(cm)" prop="size_height">
								<el-col :span="24">
									<el-input clearable v-model.trim="pointForm.size_height"
										placeholder="请输入对外尺寸_高(cm)" />
								</el-col>
							</el-form-item>
							<el-form-item label="楼号" prop="building_number">
								<el-col :span="24">
									<el-input clearable v-model.trim="pointForm.building_number" placeholder="请输入楼号" />
								</el-col>
							</el-form-item>
							<el-form-item label="层数" prop="floor">
								<el-col :span="24">
									<el-input clearable v-model.trim="pointForm.floor" placeholder="请输入层数" />
								</el-col>
							</el-form-item>
							<el-form-item label="规格" prop="media_type_specs_id">
								<el-select clearable v-model="pointForm.media_type_specs_id" placeholder="请选择规格"
									style="width:100%">
									<el-option v-for="item in media_specs_list" :key="item.id" :label="item.name"
										:value="item.id">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
					</el-row>
					<el-form-item label="位置" prop="location">
						<el-col :span="22">
							<el-input type="textarea" :autosize="{ minRows: 8}" placeholder="请输入位置"
								v-model="pointForm.location">
							</el-input>
						</el-col>
					</el-form-item>
				</el-form>
				<span slot="footer" class="dialog-footer">
					<el-button @click.native="cancelAddPoint('buildingInnerVisible')">取 消</el-button>
					<el-button type="primary" @click.native="addCommonPoint('buildingPoint')">确 定</el-button>
				</span>
			</el-dialog>
		</el-dialog>
		<!-- 市场点位-->
		<el-dialog :close-on-click-modal="false" :title="('录入')" center :visible.sync="dialogDevicePoint" width="50%"
			@close="dialogCUClose('devicePointList')">
			<el-form size="mini" v-loading="dialogPointLoading" label-width="130px" center>
				<el-row type="flex" style="margin-bottom: 20px;">
					<el-button type="primary" @click="addOnePoint('deviceInnerVisible')">新增</el-button>
				</el-row>
				<el-table :data="devicePointList" style="width: 100%" max-height="380" border>
					<el-table-column type="expand">
						<template slot-scope="props">

							<el-row :gutter="10">
								<el-col :span="12">
									<div>
										<el-form size="mini" label-position="left" inline class="demo-table-expand">
											<el-form-item label="编码:">
												<span>{{ props.row.code }}</span>
											</el-form-item>
											<el-form-item prop="pic_type_id" label="画面属性" width="150">
												<div v-for="item in pic_types">
													<div v-if="item.id == props.row.pic_type_id">
														{{ item.name }}
													</div>
												</div>
											</el-form-item>
											<el-form-item prop="media_type_specs_id" label="规格" width="150">
												<template slot-scope="scope">
													<div v-for="item in media_specs_list">
														<div v-if="item.id == props.row.media_type_specs_id">
															{{ item.name }}
														</div>
													</div>
												</template>
											</el-form-item>
											<el-form-item label="内部宽:">
												<span>{{ props.row.size_width }}</span>
											</el-form-item>
											<el-form-item label="内部高:">
												<span>{{ props.row.size_height }}</span>
											</el-form-item>
											<el-form-item label="外部宽:">
												<span>{{ props.row.size_width_inside }}</span>
											</el-form-item>
											<el-form-item label="外部高:">
												<span>{{ props.row.size_height_inside }}</span>
											</el-form-item>
											<el-form-item label="是否亮灯:">
												<span v-if="props.row.is_light===0">不亮</span>
												<span v-if="props.row.is_light===1">亮灯</span>
											</el-form-item>
											<el-form-item label="位置:">
												<span>{{ props.row.location }}</span>
											</el-form-item>
										</el-form>
									</div>
								</el-col>

								<el-col :span="12">
									<div v-if="props.row.bpoint.code">
										<el-form size="mini" label-position="right" inline class="demo-table-expand">
											<el-form-item label="编码:">
												<span>{{ props.row.bpoint.code }}</span>
											</el-form-item>
											<el-form-item prop="pic_type_id" label="画面属性" width="150">
												<div v-for="item in pic_types">
													<div v-if="item.id == props.row.bpoint.pic_type_id">
														{{ item.name }}
													</div>
												</div>
											</el-form-item>
											<el-form-item prop="media_type_specs_id" label="规格" width="150">
												<template slot-scope="scope">
													<div v-for="item in media_specs_list">
														<div v-if="item.id == props.row.media_type_specs_id">
															{{ item.name }}
														</div>
													</div>
												</template>
											</el-form-item>
											<el-form-item label="外部宽:">
												<span>{{ props.row.bpoint.size_width }}</span>
											</el-form-item>
											<el-form-item label="外部高:">
												<span>{{ props.row.bpoint.size_height }}</span>
											</el-form-item>
											<el-form-item label="内部宽:">
												<span>{{ props.row.bpoint.size_width_inside }}</span>
											</el-form-item>
											<el-form-item label="内部高:">
												<span>{{ props.row.bpoint.size_height_inside }}</span>
											</el-form-item>
											<el-form-item label="是否亮灯:">
												<span v-if="props.row.bpoint.is_light===0">不亮</span>
												<span v-if="props.row.bpoint.is_light===1">亮灯</span>
											</el-form-item>
											<el-form-item label="位置:">
												<span>{{ props.row.bpoint.location }}</span>
											</el-form-item>
										</el-form>
									</div>
								</el-col>
							</el-row>
						</template>
					</el-table-column>
					<el-table-column type="index" label="序号" width="100">
						<template slot-scope="scope">
							<span>{{ scope.$index + 1 }}</span>
						</template>
					</el-table-column>
					<el-table-column label="参数">
						<template slot-scope="scope">
							<span>A面编码:{{ scope.row.code }}</span>
							<span style="margin-left: 80px;">B面编码:{{ scope.row.bpoint.code }}</span>
						</template>
					</el-table-column>
					<!-- <el-table-column label="名称" prop="name"  width="160" /> -->
					<el-table-column width="180" label="操作">
						<template slot-scope="{row,$index}">
							<el-button type="text" style="color: red;"
								@click.native.prevent="deleteRow($index, devicePointList)">删除
							</el-button>
						</template>
					</el-table-column>
				</el-table>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click.native="dialogDevicePoint=false">取 消</el-button>
				<el-button type="primary" @click.native="onDevicePointSubmit()">确 定</el-button>
			</span>
			<!-- 内部新增弹出框-->
			<el-dialog width="80%" title="新增点位" center :visible.sync="deviceInnerVisible" append-to-body>
				<el-form size="mini" ref="devicePointForm" :rules="commonPointRules" :model="devicePointForm"
					label-width="150px" center>
					<div>A面：</div>
					<el-row :gutter="10">
						<el-col :span="12">
							<el-form-item label="编号" prop="code">
								<el-col :span="24">
									<el-input clearable v-model.trim="devicePointForm.code" placeholder="请输入编号" />
								</el-col>
							</el-form-item>
							<el-form-item label="画面属性" prop="pic_type_id">
								<el-select clearable v-model="devicePointForm.pic_type_id" placeholder="请选择画面属性"
									style="width:100%">
									<el-option v-for="item in pic_types" :key="item.id" :label="item.name"
										:value="item.id">
									</el-option>
								</el-select>
							</el-form-item>
							<el-form-item label="是否亮灯" prop="is_light">
								<el-select clearable v-model="devicePointForm.is_light" placeholder="请选择">
									<el-option label="不亮" :value="0"></el-option>
									<el-option label="亮灯" :value="1"></el-option>
								</el-select>
							</el-form-item>
							<el-form-item label="规格" prop="media_type_specs_id">
								<el-select clearable v-model="devicePointForm.media_type_specs_id" placeholder="请选择规格"
									style="width:100%">
									<el-option v-for="item in media_specs_list" :key="item.id" :label="item.name"
										:value="item.id">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="对外尺寸_宽(cm)" prop="size_width">
								<el-col :span="24">
									<el-input clearable v-model.trim="devicePointForm.size_width"
										placeholder="请输入对外尺寸_宽(cm)" />
								</el-col>
							</el-form-item>
							<el-form-item label="对外尺寸_高(cm)" prop="size_height">
								<el-col :span="24">
									<el-input clearable v-model.trim="devicePointForm.size_height"
										placeholder="请输入对外尺寸_高(cm)" />
								</el-col>
							</el-form-item>
							<el-form-item label="对内尺寸_宽(cm)：" prop="size_width_inside">
								<el-col :span="24">
									<el-input clearable v-model.trim="devicePointForm.size_width_inside"
										placeholder="请输入对内尺寸_宽" />
								</el-col>
							</el-form-item>

							<el-form-item label="对内尺寸_高(cm)：" prop="size_height_inside">
								<el-col :span="24">
									<el-input clearable v-model.trim="devicePointForm.size_height_inside"
										placeholder="请输入对内尺寸_高" />
								</el-col>
							</el-form-item>
						</el-col>
					</el-row>
					<el-form-item label="位置" prop="location">
						<el-col :span="22">
							<el-input type="textarea" :autosize="{ minRows: 4}" placeholder="请输入位置"
								v-model="devicePointForm.location">
							</el-input>
						</el-col>
					</el-form-item>

					<el-divider></el-divider>
					<div>B面：</div>
					<el-row :gutter="10">
						<el-col :span="12">
							<el-form-item label="编号" prop="bpoint.code">
								<el-col :span="24">
									<el-input clearable v-model.trim="devicePointForm.bpoint.code"
										placeholder="请输入编号" />
								</el-col>
							</el-form-item>
							<el-form-item label="画面属性">
								<el-select clearable v-model="devicePointForm.bpoint.pic_type_id" placeholder="请选择画面属性"
									style="width:100%">
									<el-option v-for="item in pic_types" :key="item.id" :label="item.name"
										:value="item.id">
									</el-option>
								</el-select>
							</el-form-item>
							<el-col :span="12">
								<el-form-item label="是否亮灯">
									<el-col :span="24">
										<el-select clearable v-model="devicePointForm.bpoint.is_light"
											placeholder="请选择">
											<el-option label="不亮" :value="0"></el-option>
											<el-option label="亮灯" :value="1"></el-option>
										</el-select>
									</el-col>
								</el-form-item>
								<el-form-item label="规格">
									<el-select clearable v-model="devicePointForm.bpoint.media_type_specs_id"
										placeholder="请选择规格" style="width:100%">
										<el-option v-for="item in media_specs_list" :key="item.id" :label="item.name"
											:value="item.id">
										</el-option>
									</el-select>
								</el-form-item>
							</el-col>
						</el-col>
						<el-col :span="12">
							<el-form-item label="对外尺寸_宽(cm)">
								<el-col :span="24">
									<el-input clearable v-model.trim="devicePointForm.bpoint.size_width"
										placeholder="请输入对外尺寸_宽(cm)" />
								</el-col>
							</el-form-item>
							<el-form-item label="对外尺寸_高(cm)">
								<el-col :span="24">
									<el-input clearable v-model.trim="devicePointForm.bpoint.size_height"
										placeholder="请输入对外尺寸_高(cm)" />
								</el-col>
							</el-form-item>
							<el-form-item label="对内尺寸_宽(cm)：">
								<el-input clearable v-model.trim="devicePointForm.bpoint.size_width_inside"
									placeholder="请输入对内尺寸_宽" />
							</el-form-item>

							<el-form-item label="对内尺寸_高(cm)：">
								<el-input clearable v-model.trim="devicePointForm.bpoint.size_height_inside"
									placeholder="请输入对内尺寸_高" />
							</el-form-item>
						</el-col>
					</el-row>
					<el-form-item label="位置">
						<el-col :span="22">
							<el-input type="textarea" :autosize="{ minRows: 4}" placeholder="请输入位置"
								v-model="devicePointForm.bpoint.location">
							</el-input>
						</el-col>
					</el-form-item>
				</el-form>
				<span slot="footer" class="dialog-footer">
					<el-button @click.native="cancelAddPoint('deviceInnerVisible')">取 消</el-button>
					<el-button type="primary" @click.native="addCommonPoint('devicePoint')">确 定</el-button>
				</span>
			</el-dialog>
		</el-dialog>

		<!-- 上传excel弹窗 -->
		<el-dialog title="批量录入点位" :visible.sync="dialogUploadFile" width="30%" ref="newUploadForm"
			:model="newUploadForm" center @close="handleClose()">
			<el-form size="mini" label-width="140px" label-position="right">
				<el-row>
					<!-- <el-col :span="19">
            <el-form-item label="上传文件" prop="fileName">
              <el-input v-model="fileName" :readonly='true' placeholder="文件名" style="width:510px;"></el-input>
            </el-form-item>
          </el-col> -->
					<el-col :span="10">
						<el-upload ref="upload" :limit="1" :file-list="fileList" :before-remove="beforeRemove"
							:on-change="beforeUpload" :auto-upload="false" :action="uploadUrl">
							<el-button slot="trigger" type="primary" plain>选取文件</el-button>
						</el-upload>
					</el-col>
				</el-row>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="handleClose()">取 消</el-button>
				<el-button type="primary" @click="submitUpload()">确 定</el-button>
			</span>
		</el-dialog>
		<el-popover ref="popoverDev" placement="top" width="150" trigger="hover" content="功能开发中..."
			popper-class="text-bold">
		</el-popover>

		<el-dialog width="30%" title="选择时间段" center :visible.sync="selectDateRangeVisible"
			@close="cuFormTwo.date_range = []">
			<div style="text-align: center">
				<el-form size="mini" :model="cuFormTwo" ref="cuFormTwo" label-width="100px" label-position="right">
					<el-form-item label="时间段" prop="date_range"
						:rules="[{ required: true, message: '请选择时间段', trigger: '@' }]">
						<el-date-picker v-model="cuFormTwo.date_range" type="daterange" range-separator="至"
							start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd"
							format="yyyy年MM月dd日">
						</el-date-picker>
					</el-form-item>
				</el-form>
			</div>
			<span slot="footer" class="dialog-footer">
				<el-button size="mini" @click="selectDateRangeVisible = false">取 消</el-button>
				<el-button size="mini" type="primary" @click="exportExcel">确 定</el-button>
			</span>
		</el-dialog>

    <el-dialog width="30%" title="选择指派工人" center :visible.sync="selectWorkerVisible"
               @close="cuFormWorker.worker_ids = []">
      <div style="text-align: center">
        <el-form size="mini" :model="cuFormWorker" ref="cuFormWorker" label-width="100px" label-position="right">
          <el-form-item label="指派工人" prop="worker_ids">
            <el-col :span="24">
              <el-select filterable clearable v-model="cuFormWorker.worker_ids" multiple
                         placeholder="请选择指派工人" style="width:100%">
                <el-option v-for="item in workers" :key="item.id" :label="item.name"
                           :value="item.id">
                </el-option>
              </el-select>
            </el-col>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
				<el-button size="mini" @click="selectWorkerVisible = false">取 消</el-button>
				<el-button size="mini" type="primary" @click="submitWorker">确 定</el-button>
			</span>
    </el-dialog>

		<el-dialog width="80%" title="新增" center :visible.sync="dialogCommon" @close="dialogCommonClose">
			<el-form ref="commonForm" v-loading="dialogLoading" size="mini" :rules="commonRules" :model="commonForm"
				label-width="150px" center>
				<el-row :gutter="10">
					<el-col :span="12">
						<el-form-item label="编号" prop="code">
							<el-col :span="24">
								<el-input v-model.trim="commonForm.code" clearable placeholder="请输入编号" />
							</el-col>
						</el-form-item>
						<el-form-item label="方向" prop="direction">
							<el-col :span="24">
								<el-select v-model="commonForm.direction" style="width: 100%" clearable
									placeholder="请选择方向">
									<el-option value="横向" />
									<el-option value="竖向" />
								</el-select>
							</el-col>
						</el-form-item>
						<el-form-item label="颜色模式" prop="color_mode">
							<el-col :span="24">
								<el-select v-model="commonForm.color_mode" style="width: 100%" clearable
									placeholder="请选择颜色模式">
									<el-option v-for="item in colorModeArr" :key="item.id" :value="item.id"
										:label="item.name">
									</el-option>
								</el-select>
							</el-col>
						</el-form-item>
						<el-form-item style="margin-bottom: 0" label="分辨率" prop="resolving_power_value">
							<el-form-item style="display: inline-block;width: 50%;padding-right: 15px;"
								prop="resolving_power_value">
								<el-input v-model="commonForm.resolving_power_value" placeholder="请输入分辨率"></el-input>
							</el-form-item>
							<el-form-item style="display: inline-block;width: 50%;" prop="resolving_power">
								<el-select v-model="commonForm.resolving_power" style="width: 100%" clearable
									placeholder="请选择分辨率单位">
									<el-option v-for="item in resolvingPowerArr" :key="item.id" :value="item.id"
										:label="item.name" />
								</el-select>
							</el-form-item>
						</el-form-item>
						<el-form-item label="开启时间" prop="opening_time">
							<el-col :span="24">
								<el-time-picker v-model="commonForm.opening_time" value-format="HH-mm-ss"
									placeholder="请选择开启时间" />
							</el-col>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="宽(cm)" prop="size_width">
							<el-col :span="24">
								<el-input v-model.trim="commonForm.size_width" clearable placeholder="请输入外部尺寸_宽(cm)" />
							</el-col>
						</el-form-item>
						<el-form-item label="高(cm)" prop="size_height">
							<el-col :span="24">
								<el-input v-model.trim="commonForm.size_height" clearable placeholder="请输入外部尺寸_高(cm)" />
							</el-col>
						</el-form-item>
						<!--            <el-form-item v-if="detailData.type_id==81 || detailData.type_id == 79" label="媒体类型："-->
						<!--                          prop="media_type_id"-->
						<!--            >-->
						<!--              <el-select v-model="commonForm.media_type_id" clearable placeholder="请选择媒体属性" style="width:100%">-->
						<!--                <el-option v-for="item in media_ids" :key="item.id" :label="item.name" :value="item.id"/>-->
						<!--              </el-select>-->
						<!--            </el-form-item>-->
						<el-form-item label="规格" prop="media_type_specs_id">
							<el-select v-model="commonForm.media_type_specs_id" clearable placeholder="请选择规格"
								style="width:100%">
								<el-option v-for="item in media_specs_list" :key="item.id" :label="item.name"
									:value="item.id" />
							</el-select>
						</el-form-item>
						<el-form-item label="颜色位数" prop="color_bits">
							<el-col :span="24">
								<el-select v-model="commonForm.color_bits" style="width: 100%" clearable
									placeholder="请选择颜色位数">
									<el-option v-for="item in colorBitsArr" :key="item.id" :label="item.name"
										:value="item.id" />
								</el-select>
							</el-col>
						</el-form-item>
						<el-form-item label="视频格式" prop="video_format">
							<el-col :span="24">
								<el-select v-model="commonForm.video_format" style="width: 100%" clearable
									placeholder="请选择视频格式">
									<el-option v-for="item in videoFormatArr" :key="item.id" :label="item.name"
										:value="item.id" />
								</el-select>
							</el-col>
						</el-form-item>
						<el-form-item label="关闭时间" prop="closing_time">
							<el-col :span="24">
								<!--                <el-select v-model="commonForm.closing_time" style="width: 100%" clearable placeholder="请选择关闭时间" />-->
								<el-time-picker v-model="commonForm.closing_time" placeholder="结束时间"
									value-format="HH-mm-ss" />
							</el-col>
						</el-form-item>
					</el-col>
				</el-row>
				<el-form-item label="位置" prop="location">
					<el-col :span="22">
						<el-input v-model="commonForm.location" type="textarea" :autosize="{ minRows: 4}"
							placeholder="请输入位置" />
					</el-col>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click.native="dialogCommon=false">取 消</el-button>
				<el-button type="primary" @click.native="onSubmitCommon()">确 定</el-button>
			</span>
		</el-dialog>
	</div>
</template>

<script>
	import {
		getUrl
	} from '@/api/upload'
	import {
		aline_point_num,
		aline_point_num_by_id,
		building_area_add,
		building_area_del,
		building_area_edit,
		ip_location,
		list,
		pc_list_all,
		search_address,
		selectSearchAreaVO,
		get_media_types,
		get_media_types_for_building_type,
		get_media_type_id,
		get_media_type_relation,
    export_building_media_point_excel,
    assign_worker
	} from '@/api/building/building'
	import {
		media_specs_list
	} from '@/api/media/specs'
	import {
		pointAdd,
		checkCode,
		checkABCode,
		uploadPoint,
		uploadABPoint
	} from '@/api/point/point'
	import {
		list_all4th_by2ndcode,
		list_all3rd_bycode,
		list_all3rd_bycode_contrain_del_close,
		list_all3rd_bytopcode
	} from '@/api/business/setting/dict'

	import UploadImage from '@/components/UploadImage'
	import common from '@/utils/common.js'
	import {
		formatDate,
		generateUUID,
		isArray,
		isTrue
	} from '@/utils/util.js'
	import {
		cloneDeep
	} from 'lodash'
	import moment from 'moment'
	import {
		list_media_types_of_gas_station
	} from '@/api/building/building'
	import FileUpload from '@/components/FileUploadNew'
	import {
		getUploadExcelUrl
	} from '@/api/upload'
	import {
		getToken
	} from '@/utils/auth'
	import {
		Message
	} from 'element-ui'
	// 富文本
	import QuillEditorOwn from '@/components/QuillEditorOwn'
	import {
		export_leave_unused_point_excel
	} from '@/api/point/media'
	import {
		allList
	} from '@/api/system/specs_manage'
  import { listWorker } from '@/api/workOrder/workOrder'

	export default {
		name: 'BuildingAreaList',
		components: {
			UploadImage,
			QuillEditorOwn,
			FileUpload
		},
		// beforeRouteLeave(to, from, next) {
		// 	this.$destroy()
		// 	next()
		// },
		data() {
			var validateCode = (rule, value, callback) => {
				if (!value) {
					return callback(new Error('编码不能为空'))
				}
				this.checkCode(value)
				this.checkACode(value)
				setTimeout(() => {
					if (!this.isRepeat) {
						callback(new Error('此编码已存在'))
					} else {
						callback()
					}
				}, 500)
			}

			var validateBCode = (rule, value, callback) => {
				if (!value) {
					callback()
				}
				this.checkCode(value)
				if (value != null && value != '') {
					this.checkBCode(value)
				}
				setTimeout(() => {
					if (!this.isRepeat) {
						callback(new Error('此编码已存在'))
					} else {
						callback()
					}
				}, 500)
			}

			var chackTime = (rule, value, callback) => {
				if (this.commonForm.opening_time !== null && this.commonForm.closing_time != null) {
					let openTime = this.commonForm.opening_time.toString().split('-')
					let closeTime = this.commonForm.closing_time.toString().split('-')
					let flag
					if (openTime[0] < closeTime[0]) {
						flag = true
					} else if (openTime[1] < closeTime[1]) {
						flag = true
					} else if (openTime[2] < closeTime[2]) {
						flag = true
					} else {
						flag = false
					}
					if (flag) {
						callback()
					} else {
						callback(new Error('结束时间需要大于开启时间'))
					}
				} else {
					callback()
				}
			}

			return {
        tableMaxHeight: 0,
				isRepeat: false,
				isARepeat: false,
				isBRepeat: false,
				// 搜索结果弹框可见性
				searchDialogVisible: false,
				// 搜索结果列表
				searchAddresses: [],
				// 所有省市
				pcAll: [],
				// 添加新楼盘 选地址表单
				addNewSearchForm: {
					pca: null,
					address: null
				},
				// 点位类型
				media_types: [],
				media_types_map: new Map(),
				type_map: new Map(),
				// 点位类型, 项目类型特化
				media_types_for_building_type: [],
				media_specs_list: [],
				// 社区分类
				types: [],
				typesMap: new Map(),
				// 社区二级分类
				types_second: new Map(),
				// 受众描述
				audiences: [],
        // 指派工人
        workers: [],
				// 物业费单位列表
				management_fee_unit_ids: [],
				// 项目id
				area_id: null,
				// 媒体类型id
				media_id: null,
				// 楼盘编辑框loading
				dialogCULoading: false,
				// 增修弹框可见性
				dialogCU: false,
				// 楼盘信息表单
				cuForm: {
					id: null,
					photo: null,
					name: null,
					lat: null,
					lng: null,
					province: null,
					city: null,
					area: null,
					cdcode: null,
					address: null,
					price: null,
					type_id: 78,
					type_id_second: null,
					scale: null,
					fix_sale_count_per_time: null,
					occupancy_rate: null,
					audience_ids: [],
          worker_ids: [],
					parking_count: null,
          elevator_count: null,
          elevator_type: true,//默认双梯
					management_fee: null,
					management_fee_unit_id: null,
					forbid_industry_ids: [],
					highest_floor: null,
					check_in_at: null,
					has_compete: false,
					can_ground_promote: true,
					can_paid_ad: true,
					location_supply: null,
					cover_location: null,
					cover_people_count: null,
					remark: null,
					default_worker_id: null,
					points: [],
					media_types: {},
					mediaTypeRelation: []
				},

				files: null,
				fileList: [],
				fileName: null,
				formRules: {},
				uploadUrl: null,
				newUploadForm: {
					fileName: '',
					building_area_id: null,
					type_id: null,
					type_id_second: null
				},
				dialogFileLoading: false,
				dialogUploadFile: false,

				// 点位录入框loading
				dialogPointLoading: false,
				// 普通点位录入框可见性
				dialogCommonPoint: false,
				// 普通点位新增内部弹出框
				commonInnerVisible: false,
				// 普通点位弹窗表格list
				commonPointList: [],
				// 住宅点位录入框可见性
				dialogBuildingPoint: false,
				// 住宅点位新增内部弹出框
				buildingInnerVisible: false,
				// 住宅点位弹窗表格list
				buildingPointList: [],
				// 市场点位录入框可见性
				dialogDevicePoint: false,
				// 市场点位新增内部弹出框
				deviceInnerVisible: false,
				pic_types: [],
				building_types: [{
						id: 1,
						name: '多层'
					},
					{
						id: 2,
						name: '高层'
					}
				],
				media_ids: [],
				devicePointList: [],
				// 点位信息表单
				pointForm: {
					id: null,
					building_area_id: null,
					media_type_id: null,
					code: null,
					pic_type_id: null,
					building_type: null,
					building_number: null,
					unit_number: null,
					floor: null,
					door_number: null,
					location: null,
					size_width: null,
					size_height: null,
					size_width_inside: null,
					size_height_inside: null,
					media_type_specs_id: null

				},
				// 市场点位信息表单
				devicePointForm: {
					building_area_id: null,
					media_type_id: null,
					ab_type_id: null,
					code: null,
					pic_type_id: null,
					location: null,
					size_width: null,
					size_height: null,
					size_width_inside: null,
					size_height_inside: null,
					is_light: null,
					media_type_specs_id: null,
					bpoint: {
						building_area_id: null,
						media_type_id: null,
						ab_type_id: null,
						code: null,
						pic_type_id: null,
						location: null,
						size_width: null,
						size_height: null,
						size_width_inside: null,
						size_height_inside: null,
						is_light: null,
						media_type_specs_id: null
					}
				},
				workerList: [],
				building_area_type_id: null,
				// 表单校验
				cuRules: {
					name: [{
						required: true,
						message: '请输入名称',
						trigger: 'blur'
					}]
				},
				// 普通点位新增校验
				commonPointRules: {
					code: [{
						validator: validateCode,
						trigger: 'blur'
					}],
					bpoint: {
						code: [{
							validator: validateBCode,
							trigger: 'blur'
						}]
					},
					// location: [{
					//   required: true,
					//   message: '请输入位置',
					//   trigger: 'blur'
					// }],
					pic_type_id: [{
						required: true,
						message: '请选择画面属性',
						trigger: 'blur'
					}],
					media_type_specs_id: [{
						required: true,
						message: '请选择规格',
						trigger: 'blur'
					}],
					media_type_id: [{
						required: true,
						message: '请选择媒体类型',
						trigger: 'blur'
					}],
					building_type: [{
						required: true,
						message: '请选择楼层类型',
						trigger: 'blur'
					}],
					floor: [{
						required: true,
						message: '层数不能为空',
						trigger: 'blur'
					}],
					building_number: [{
						required: true,
						message: '楼号不能为空',
						trigger: 'blur'
					}],
					unit_number: [{
						required: true,
						message: '单元号不能为空',
						trigger: 'blur'
					}],
					size_width: [{
						required: true,
						message: '对外宽不能为空',
						trigger: 'blur'
					}, {
						pattern: /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/,
						message: '请输入合法数字(支持2位小数)',
						trigger: 'blur'
					}],
					size_height: [{
						required: true,
						message: '对外高不能为空',
						trigger: 'blur'
					}, {
						pattern: /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/,
						message: '请输入合法数字(支持2位小数)',
						trigger: 'blur'
					}],
					size_width_inside: [{
						required: true,
						message: '对内宽不能为空',
						trigger: 'blur'
					}, {
						pattern: /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/,
						message: '请输入合法数字(支持2位小数)',
						trigger: 'blur'
					}],
					size_height_inside: [{
						required: true,
						message: '对内高不能为空',
						trigger: 'blur'
					}, {
						pattern: /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/,
						message: '请输入合法数字(支持2位小数)',
						trigger: 'blur'
					}],
					is_light: [{
						required: true,
						message: '请选择是否亮灯',
						trigger: 'blur'
					}]
				},
				// list table
				tableData: [], // 列表数据
				selectIds: [], // 多选选项id
				selectRows: [], // 选中的行
				tabLoading: false,
				total: null, // 总页数
				current: 1, // 当前页

				listParams: {
					name: null,
					province: null,
					city: null,
					area: null,
					address: null,
					media_type_spec_ids_str: null,

					page: 1,
					page_size: 10
				}, // list参数
				searchForm: {
					name: null,
					province: null,
					city: null,
					area: null,
					address: null,
					adcode: null,
					media_type_spec_ids: []
				},
				searchAreaVOList: [],

				industryList: [],

				pointCountInputDisabled: false,
				loading: null,
				cuFormTwo: {
					date_range: []
				},
				selectDateRangeVisible: false,
        selectWorkerVisible: false,
        cuFormWorker: {
          worker_ids: []
        },
				mediaTypeSpecArr: [],
				dialogCommon: false,
				dialogLoading: false,
				commonRules: {
					code: [{
						validator: validateCode,
						trigger: 'blur'
					}],
					// location: [{
					//   required: true,
					//   message: '请输入位置',
					//   trigger: 'blur'
					// }],
					// pic_type_id: [{
					//   required: true,
					//   message: '请选择画面属性',
					//   trigger: 'blur'
					// }],
					floor: [{
						required: true,
						message: '层数不能为空',
						trigger: 'blur'
					}],
					building_type: [{
						required: true,
						message: '请选择楼层类型',
						trigger: 'blur'
					}],
					media_type_specs_id: [{
						required: true,
						message: '请选择规格',
						trigger: 'change'
					}],
					building_number: [{
						required: true,
						message: '楼号不能为空',
						trigger: 'blur'
					}],
					unit_number: [{
						required: true,
						message: '单元号不能为空',
						trigger: 'blur'
					}],
					size_width: [{
						required: true,
						message: '对外宽不能为空',
						trigger: 'blur'
					}, {
						pattern: /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/,
						message: '请输入合法数字(支持2位小数)',
						trigger: 'blur'
					}],
					size_height: [{
						required: true,
						message: '对外高不能为空',
						trigger: 'blur'
					}, {
						pattern: /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/,
						message: '请输入合法数字(支持2位小数)',
						trigger: 'blur'
					}],
					size_width_inside: [{
						required: true,
						message: '对内宽不能为空',
						trigger: 'blur'
					}, {
						pattern: /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/,
						message: '请输入合法数字(支持2位小数)',
						trigger: 'blur'
					}],
					size_height_inside: [{
						required: true,
						message: '对内高不能为空',
						trigger: 'blur'
					}, {
						pattern: /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/,
						message: '请输入合法数字(支持2位小数)',
						trigger: 'blur'
					}],
					direction: [{
						required: true,
						message: '方向不能为空',
						trigger: 'change'
					}],
					resolving_power: [{
						required: true,
						message: '分辨率单位不能为空',
						trigger: 'change'
					}],
					resolving_power_value: [{
						required: true,
						message: '分辨率不能为空',
						trigger: 'blur'
					}],
					color_mode: [{
						required: true,
						message: '颜色模式不能为空',
						trigger: 'change'
					}],
					color_bits: [{
						required: true,
						message: '颜色位数不能为空',
						trigger: 'change'
					}],
					opening_time: [{
						required: true,
						message: '开启时间不能为空',
						trigger: 'change'
					}],
					closing_time: [{
						required: true,
						message: '关闭时间不能为空',
						trigger: 'change'
					}, {
						validator: chackTime,
						trigger: 'blur'
					}],
					video_format: [{
						required: true,
						message: '视频格式不能为空',
						trigger: 'change'
					}]
				},
				commonForm: {
					id: null,
					code: null,
					pic_type_id: null,
					media_type_id: null,
					ab_type_id: null,
					building_area_id: null,
					building_type: null,
					building_number: null,
					unit_number: null,
					floor: null,
					door_number: null,
					location: null,
					size_width: null,
					size_height: null,
					size_width_inside: null,
					size_height_inside: null,
					is_light: null,
					media_type_specs_id: null,
					direction: null,
					resolving_power: null,
					resolving_power_value: null,
					color_mode: null,
					color_bits: null,
					opening_time: null,
					closing_time: null,
					video_format: null
				},
				videoFormatArr: [],
				colorBitsArr: [],
				colorModeArr: [],
				resolvingPowerArr: [],
				detailData: {
					type_id: null
				}
			}
		},
		mounted() {
			this.getIndustryList()
			this.getManagementFeeUnitIds()
			this.getPCListAll()
			this.selectSearchArea()
			this.getTypes()
			this.getTypesSecond()
			this.getPicTypes()
			this.getAudiences()
      this.getWorkers()
			this.getMediaTypes()
			this.getMediaTypesForBuildingType()
			this.getList()
			this.getIPLocation()
			this.getMediaIds()
			this.getMediaTypeRelation()
			this.getMediaTypeAndSpecName()
		},
		created() {
      this.tableMaxHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 210
      this.getUploadUrl()
			this.initVideoFormatArr()
			this.initColorBitsArr()
			this.initColorModeArr()
			this.initResolvingPowerArr()
		},
		methods: {
			// 校准点位数量确认
			async showAlineNumConfirm(id) {
				const that = this
				const str =
					'<div>此操作将根据<span class="text-red">“已激活”</span>的设备数，修改预设的点位数量（可多次调用）。<br/>您确定要校准吗？<br/><br/><span class="text-xs"><span class="text-red">已激活</span>：有<span class="text-red">“新安装/上刊”通过记录</span>的设备</span></div>'
				const flag = await common.confirmDialog(str)
				if (flag) {
					const loading = common.showLoading({
						text: '校准中'
					})
					if (id) {
						aline_point_num_by_id({
								id: id
							})
							.then(res => {
								const {
									code,
									data
								} = res
								if (!!loading) loading.close()
								if (code == 200 && isTrue(data)) {
									common.messageSuccess('校准成功')
									that.getList()
								} else {
									common.messageError('校准失败')
								}
							})
							.catch(() => {
								if (!!loading) loading.close()
								common.messageError('校准失败')
							})
					} else {
						aline_point_num()
							.then(res => {
								const {
									code,
									data
								} = res
								if (!!loading) loading.close()
								if (code == 200 && isTrue(data)) {
									common.messageSuccess('校准成功')
									that.getList()
								} else {
									common.messageError('校准失败')
								}
							})
							.catch(() => {
								if (!!loading) loading.close()
								common.messageError('校准失败')
							})
					}

				}
			},
			getUploadUrl() {
				this.uploadUrl = getUrl()
			},
			getIndustryList() {
				return list_all3rd_bycode_contrain_del_close({
						code: 'khxg-hy'
					})
					.then(res => {
						this.industryList = res.data
					})
			},
			getManagementFeeUnitIds() {
				return list_all3rd_bycode_contrain_del_close({
						code: 'xmxg-wyfdw'
					})
					.then(res => {
						this.management_fee_unit_ids = res.data
					})
			},
			// 获取所有省市
			getPCListAll() {
				const that = this
				return new Promise((resolve, reject) => {
					pc_list_all()
						.then(res => {
							const {
								code,
								data
							} = res
							if (code == 200) {
								if (data && data.length > 0) {
									that.pcAll = data
									resolve()
								}
							}
						})
				})

			},
			// 获取地址分类
			selectSearchArea() {
				const that = this
				return selectSearchAreaVO()
					.then(res => {
						const {
							code,
							data
						} = res
						if (code == 200) {
							for (let i = 0; i < data.length; i++) {
								if (data[i] && data[i].adcode) {
									that.searchAreaVOList.push(data[i])
								}
							}
						}
					})
			},
			// 获取社区分类
			getTypes() {
				const that = this
				return list_all3rd_bycode({
						code: 'xmxg-fl'
					})
					.then(res => {
						const {
							code,
							data
						} = res
						if (code == 200) {
							that.types = data
							that.typesMap = new Map();
							(data || []).forEach(t => {
								that.typesMap.set(parseInt(t.id), t)
							})
						}
					})
			},
			getPicTypes() {
				const that = this
				return list_all3rd_bycode({
						code: 'dwxg-hmsx'
					})
					.then(res => {
						const {
							code,
							data
						} = res
						if (code == 200) {
							that.pic_types = data
						}
					})
			},
			// 获取社区分类
			getTypesSecond() {
				const that = this
				return list_all4th_by2ndcode({
						code: 'xmxg-fl'
					})
					.then(res => {
						const {
							code,
							data
						} = res
						if (code == 200) {
							let map = new Map();
							(data || []).forEach(d => {
								let list = map.get(parseInt(d.pid)) || []
								list.push(d)
								map.set(parseInt(d.pid), list)
							})
							that.types_second = map
						}
					})
			},
			// 获取受众描述
			getAudiences() {
				const that = this
				return list_all3rd_bycode({
						code: 'xmxg-sz'
					})
					.then(res => {
						const {
							code,
							data
						} = res
						if (code == 200) {
							that.audiences = data
						}
					})
			},
      // 获取工人
      getWorkers() {
        listWorker().then(res => {
          this.workers = res.data
        })
      },
      // 获取点位类型
			getMediaTypes() {
				const that = this
				return get_media_types()
					.then(res => {
						const {
							code,
							data
						} = res
						if (code == 200) {
							that.media_types = data || []
							that.media_types_map = new Map();
							(data || []).forEach(d => {
								that.media_types_map.set(parseInt(d.id), d)
								that.$set(that.cuForm.media_types, '' + d.id, 0)
							})
						}
					})
			},
			getMediaTypeRelation() {
				const that = this
				return get_media_type_relation()
					.then(res => {
						const {
							code,
							data
						} = res
						if (code == 200) {
							that.mediaTypeRelation = data || []

							that.type_map = new Map();
							(data || []).forEach(d => {
								that.type_map.set(parseInt(d.building_area_type_id), d.media_type_ids)
							})
						}
					})
			},
			getMediaTypeId(id) {
				const that = this
				return new Promise((resolve, reject) => {
					get_media_type_id({
							building_area_type_id: id
						})
						.then(res => {
							const {
								code,
								data
							} = res
							if (code == 200) {
								that.media_id = data
								resolve()
							}
						})
						.catch(() => {
							resolve(null)
						})
				})
			},
			async getSpecsList() {
				const that = this
				await that.getMediaTypeId(that.building_area_type_id)
				var obj = Object.assign({}, {
					mediaTypeId: that.media_id,
					page: 1,
					page_size: 100
				})
				media_specs_list(obj)
					.then(res => {
						const {
							code,
							message
						} = res
						if (code === 200) {
							this.media_specs_list = res.data.records
						}

					})
					.catch(() => {

					})
			},
			getMediaIds() {
				const that = this
				return list_media_types_of_gas_station()
					.then(res => {
						const {
							code,
							data
						} = res
						if (code == 200) {
							that.media_ids = data || []
						}
					})
			},
			// 获取点位类型
			getMediaTypesForBuildingType() {
				const that = this
				return get_media_types_for_building_type()
					.then(res => {
						const {
							code,
							data
						} = res
						if (code == 200) {
							that.media_types_for_building_type = data.map(d => {
								d.key = d.id + (!d.building_type_id ? '' : ('_' + d.building_type_id + (!d
									.building_type_id_second ? '' : ('_' + d
										.building_type_id_second))))
								d.label = d.name + (!d.building_type_id ? '' : ('（' + d.building_type + (!d
									.building_type_id_second ? '' : ('-' + d.building_type_second)
								) + '）'))
								return d
							})
						}
					})
			},
			// 改变项目分类
			changeType() {
				const that = this
				if (that.cuForm.type_id == 84) { // 大牌或大屏，默认一个项目对应一个点位
					if (that.cuForm.type_id == 84) that.$set(that.cuForm.media_types, '11', 1)
					that.pointCountInputDisabled = true
				} else {
					that.pointCountInputDisabled = false
				}

			},
			getList() {
				this.tabLoading = true
				return list(this.listParams)
					.then(res => {
						let {
							data: {
								records,
								total
							}
						} = res

						this.tableData = records.map(item => {

							return item
						})
						// console.log(this.tableData)
						this.total = total
						this.tabLoading = false
					})
					.catch(() => {
						this.tabLoading = false
					})
				// console.log(this.tableData)
			},

			// 获取ip定位
			getIPLocation() {
				const that = this
				return new Promise((resolve, reject) => {
					ip_location()
						.then(res => {
							const {
								code,
								data: {
									status,
									result
								}
							} = res
							if (code == 200 && status == 0) {
								var adcode = result.ad_info.adcode
								const p = ('' + adcode).substring(0, 2)
								if ('' + p === '11' || '' + p === '12' || '' + p === '31' || '' + p === '50' ||
									'' + p === '81' || '' +
									p === '82') {
									// 直辖市和港澳时，只有一级
									that.addNewSearchForm.pca = [('' + adcode).substring(0, 2) + '0000']
								} else {
									that.addNewSearchForm.pca = [('' + adcode).substring(0, 2) + '0000', ('' +
											adcode).substring(0, 4) +
										'00'
									]
								}
							}
						})
				})
			},
			// 选择查询结果，弹出新增框，自动填充
			chooseSearchADItemToAddPoint({
				ad_info: {
					province,
					city,
					district,
					adcode
				},
				address,
				location: {
					lat,
					lng
				},
				title
			}) {
				const that = this
				that.cuForm.lat = lat
				that.cuForm.lng = lng
				that.cuForm.name = title
				that.cuForm.province = province
				that.cuForm.city = city
				that.cuForm.area = district
				that.cuForm.adcode = adcode
				that.cuForm.address = address
				that.closeSearchDialog()

			},
			// 查询地址
			searchAddress() {
				const that = this
				that.addNewSearchForm.address = that.cuForm.name
				if (!that.addNewSearchForm.pca || that.addNewSearchForm.pca.length == 0) {
					common.message({
						message: '请选择省市',
						type: 'error'
					})
					return false
				}
				if (!that.addNewSearchForm.address) {
					common.message({
						message: '请输入名称',
						type: 'error'
					})
					return false
				}
				const loading = common.showLoading({
					text: '搜索中'
				})
				search_address({
						keyword: that.addNewSearchForm.address,
						boundary: that.addNewSearchForm.pca[that.addNewSearchForm.pca.length - 1]
					})
					.then(res => {
						const {
							code,
							data: {
								data
							}
						} = res
						if (code == 200) {
							loading.close()
							that.searchAddresses = data
							that.searchDialogVisible = true
						}
					})
					.catch(() => {
						loading.close()
					})
			},
			// 关闭查询结果弹框
			closeSearchDialog() {
				const that = this
				that.searchDialogVisible = false
				that.searchAddresses = []
			},
			// 图片上传成功回调方法
			handleUploadImageSuccess(url) {
				this.cuForm.photo = url
			},
			handleUploadImageRemove() {
				this.cuForm.photo = ''
			},
			// 楼盘详情
			showDetail(row) {
				//common.messageWarning('开发中');
				const uuid = generateUUID()
				this.$store.commit('keep/PUT_PAGE_PARAMS', {
					uuid: uuid,
					data: {
						id: row.id
					}
				})
				this.$router.push({
					name: 'building_area_detail',
					query: {
						uuid
					}
				})
				// this.$router.push({
				//   name: 'building_area_detail',
				//   params: {
				//     id: row.id
				//   }
				// })
			},
			// 新增弹出框
			showAdd(_data = {}) {
				const that = this
				let data = Object.assign({
					lat: null,
					lng: null,
					name: null,
					provice: null,
					city: null,
					area: null,
					adcode: null,
					address: null
				}, _data)
				that.dialogCU = true
				that.dialogCULoading = false
				that.resetForm()
				that.$refs['cuForm'] && this.$refs['cuForm'].resetFields()
				that.cuForm = Object.assign(that.cuForm, data)
			},
			// 编辑弹出框
			showEdit(info) {
				console.log(info)
				const that = this

				// 去除规格，合计点位数量
				let media_types = {};
				const uninstall_count = info.uninstall_media_types || {};
				const media_types_origin = info.media_types || {};
				const keys_mt = Object.keys(media_types_origin) || [];
				keys_mt.forEach(key => {
					const item = media_types_origin['' + key];
					const keys_spec = Object.keys(item) || [];
					keys_spec.forEach(inKey => {
						media_types['' + key] = parseInt(media_types['' + key] || 0) + parseInt(item['' +
							inKey] || 0);
					});
					if(!!uninstall_count[''+key]) media_types['' + key] = parseInt(media_types['' + key] || 0) + parseInt(uninstall_count[''+key] || 0);
				});

				that.cuForm = Object.assign({}, info, {
					media_types
				})
				that.dialogCU = true
				that.dialogCULoading = false
			},
			// 点位录入
			showPointAdd(info) {
				console.log(info.type_id)
				const that = this
				const type_id = info.type_id
				that.area_id = null
				that.media_id = null
				that.media_specs_list = []
				// 添加media_type_id
				that.building_area_type_id = type_id

				that.getSpecsList()
				// 住宅
				if (type_id == 78) {
					that.buildingPointList = []
					that.dialogBuildingPoint = true
					that.resetPointForm()
					that.$refs['pointForm'] && that.$refs['pointForm'].resetFields()
					that.area_id = info.id
					that.dialogPointLoading = false
				} else if (type_id == 82) {
          // 市场
					that.devicePointList = []
					that.dialogDevicePoint = true
					that.resetDevicePointForm()
					that.$refs['devicePointForm'] && that.$refs['devicePointForm'].resetFields()
					that.area_id = info.id
					that.dialogPointLoading = false
				} else if (type_id == 84) { // 如果是大屏 直接打开弹框
					this.detailData.type_id = type_id
					this.commonForm.media_type_id = 11
					this.commonForm.building_area_id = info.id
					this.$nextTick(() => {
						this.$refs.commonForm.clearValidate()
					})
					this.dialogCommon = true
				} else {
					that.commonPointList = []
					that.dialogCommonPoint = true
					that.resetPointForm()
					that.$refs['pointForm'] && that.$refs['pointForm'].resetFields()
					that.area_id = info.id
					that.dialogPointLoading = false
				}
			},
			// 加一个点位新增按钮
			addOnePoint(name) {
				switch (name) {
					case 'commonInnerVisible':
						this.commonInnerVisible = true
						this.pointForm.building_area_id = this.area_id
						this.pointForm.media_type_id = this.media_id
						break
					case 'buildingInnerVisible':
						this.buildingInnerVisible = true
						this.pointForm.building_area_id = this.area_id
						this.pointForm.media_type_id = this.media_id
						break
					case 'deviceInnerVisible':
						this.deviceInnerVisible = true
						this.devicePointForm.building_area_id = this.area_id
						this.devicePointForm.media_type_id = this.media_id
						this.devicePointForm.bpoint.building_area_id = this.area_id
						this.devicePointForm.bpoint.media_type_id = this.media_id
						this.devicePointForm.ab_type_id = 57
						this.devicePointForm.bpoint.ab_type_id = 58
						break
				}
			},
			cancelAddPoint(name) {
				switch (name) {
					case 'commonInnerVisible':
						this.commonInnerVisible = false
						this.resetPointForm()
						break
					case 'buildingInnerVisible':
						this.buildingInnerVisible = false
						this.resetPointForm()
						break
					case 'deviceInnerVisible':
						this.deviceInnerVisible = false
						this.resetDevicePointForm()
						break
				}
			},
			// 新增普通点位按钮方法
			addCommonPoint(formName) {
				switch (formName) {
					case 'commonPoint':
						this.$refs.pointForm.validate((valid) => {
							if (valid) {
								Message.success('新增成功!')
								this.commonPointList.push(this.pointForm)
								this.resetPointForm()
								this.commonInnerVisible = false
							} else {
								return false
							}
						})
						break
					case 'buildingPoint':
						this.$refs.pointForm.validate((valid) => {
							if (valid) {
								Message.success('新增成功!')
								this.buildingPointList.push(this.pointForm)
								this.resetPointForm()
								this.buildingInnerVisible = false
							} else {
								return false
							}
						})
						break
					case 'devicePoint':
						this.$refs.devicePointForm.validate((valid) => {
							if (valid) {
								// 若b面某一属性存在值 则b面所有属性都为必填
								if ((this.devicePointForm.bpoint.code != null && this.devicePointForm.bpoint
										.code != '') ||
									(this.devicePointForm.bpoint.location != null && this.devicePointForm.bpoint
										.location != '') ||
									(this.devicePointForm.bpoint.size_height != null && this.devicePointForm.bpoint
										.size_height !=
										'') ||
									(this.devicePointForm.bpoint.size_width != null && this.devicePointForm.bpoint
										.size_width !=
										'') ||
									(this.devicePointForm.bpoint.pic_type_id != null && this.devicePointForm.bpoint
										.pic_type_id != '')
								) {

									if ((this.devicePointForm.bpoint.code == null || this.devicePointForm.bpoint
											.code == '')) {
										Message.error('请先添加b面点位')
										return false
									}
									if ((this.devicePointForm.bpoint.size_height == null || this.devicePointForm
											.bpoint.size_height ==
											'')) {
										Message.error('请先添加b面外部长度')
										return false
									}
									if ((this.devicePointForm.bpoint.size_width == null || this.devicePointForm
											.bpoint.size_width ==
											'')) {
										Message.error('请先输入b面外部宽度')
										return false
									}
									if ((this.devicePointForm.bpoint.size_height_inside == null || this
											.devicePointForm.bpoint
											.size_height_inside ==
											'')) {
										Message.error('请先添加b面内部长度')
										return false
									}
									if ((this.devicePointForm.bpoint.size_width_inside == null || this
											.devicePointForm.bpoint
											.size_width_inside ==
											'')) {
										Message.error('请先输入b面内部宽度')
										return false
									}
									if ((this.devicePointForm.bpoint.pic_type_id == null || this.devicePointForm
											.bpoint.pic_type_id ==
											'')) {
										Message.error('请先选择b面画面属性')
										return false
									}
									// if ((this.devicePointForm.bpoint.location == null || this.devicePointForm.bpoint.location ==
									//   '')) {
									//   Message.error('请先输入b面位置')
									//   return false
									// }
									if ((this.devicePointForm.bpoint.is_light == null || this.devicePointForm
											.bpoint.is_light ==
											'')) {
										Message.error('请先选择b面是否亮灯')
										return false
									}
									if ((this.devicePointForm.bpoint.media_type_specs_id == null || this
											.devicePointForm.bpoint
											.media_type_specs_id ==
											'')) {
										Message.error('请先选择b面规格')
										return false
									}
								}

								// 校验编码是否符合规范
								let codeA = this.devicePointForm.code
								let codeB = this.devicePointForm.bpoint.code
								if (this.checkValidA(codeA) == false) {
									return false
								}
								if (this.isARepeat == false) {
									Message.error('该项目点位已存在此字母开头A面编码，请换一个')
									return false
								}

								if (codeB != null && codeB != '') {
									if (this.checkValidB(codeB) == false || this.checkValid(codeA, codeB) ==
										false) {
										return false
									}
									if (this.isBRepeat == false) {
										Message.error('该项目点位已存在此字母开头B面编码，请换一个')
										return false
									}
								}

								Message.success('新增成功!')
								// 如果没有添加 b面，删除b面属性
								if (!this.devicePointForm.bpoint.code) {
									this.resetBPointForm()
								}
								this.devicePointList.push(this.devicePointForm)
								this.resetDevicePointForm()
								this.deviceInnerVisible = false
							} else {
								return false
							}
						})
						break
				}
			},
			// 校验编码是否规范
			checkValidA(code) {
				if (!code.includes('-')) {
					Message.error('A面编号不规范，请以大写字母加1加-开头，标准编码例如："A1-123"')
					return false
				}
				let start = code.split('-')
				if (/^[A-Z]{1}[1]{1}?$/.test(start[0]) == false) {
					Message.error('A面编号不规范，请以大写字母加1加-开头，标准编码例如："A1-123"')
					return false
				}
			},
			checkValidB(code) {
				if (!code.includes('-')) {
					Message.error('B面编号不规范，请以大写字母加2加-开头，标准编码例如："A2-123"')
					return false
				}
				let start = code.split('-')
				if (/^[A-Z]{1}[2]{1}?$/.test(start[0]) == false) {
					Message.error('B面编号不规范，请以大写字母加2加-开头，标准编码例如："A2-123"')
					return false
				}
			},
			checkValid(codeA, codeB) {
				let startA = codeA.split('-')
				let startB = codeB.split('-')
				if (startA[0].substr(0, 1) != startB[0].substr(0, 1)) {
					Message.error('同一点位AB面编号开头必须为相同字母')
					return false
				}
			},
			// 校验code唯一
			checkCode(code) {
				return checkCode({
						'code': code
					})
					.then(res => {
						const {
							data: {}
						} = res
						this.isRepeat = res.data
					})
					.catch(() => {
						this.tabLoading = false
					})
			},

			checkACode(code) {
				return checkABCode({
						'code': code,
						'building_area_id': this.area_id
					})
					.then(res => {
						const {
							data: {}
						} = res
						this.isARepeat = res.data
					})
					.catch(() => {
						this.tabLoading = false
					})
			},

			checkBCode(code) {
				return checkABCode({
						'code': code,
						'building_area_id': this.area_id
					})
					.then(res => {
						const {
							data: {}
						} = res
						this.isBRepeat = res.data
					})
					.catch(() => {
						this.tabLoading = false
					})
			},

			async showDel(id) {
				const that = this
				that.$confirm('您确定要删除吗', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					that.onDel(id)
				}).catch(() => {})
			},

			dialogCUClose(formName) {
				const that = this
				switch (formName) {
					case 'cuForm':
						that.$refs['cuForm'].clearValidate()
						that.resetForm()
						break
					case 'commonPointList':
						that.$refs['pointForm'].clearValidate()
						that.commonPointList = []
						that.resetPointForm()
						break
					case 'buildingPointList':
						that.$refs['pointForm'].clearValidate()
						that.buildingPointList = []
						that.resetPointForm()
						break
					case 'devicePointList':
						// that.$refs['devicePointForm'].clearValidate()
						that.devicePointList = []
						that.resetDevicePointForm()
						break
				}
			},
			resetForm() {
				this.cuForm = {
					id: null,
					photo: null,
					name: null,
					lat: null,
					lng: null,
					province: null,
					city: null,
					area: null,
					cdcode: null,
					address: null,
					price: null,
					type_id: 78,
					scale: null,
					fix_sale_count_per_time: null,
					occupancy_rate: null,
					audience_ids: [],
					parking_count: null,
					management_fee: null,
					management_fee_unit_id: null,
					forbid_industry_ids: [],
          worker_ids: [],
					highest_floor: null,
					check_in_at: null,
					has_compete: false,
					can_ground_promote: true,
					can_paid_ad: true,
					location_supply: null,
					cover_location: null,
					cover_people_count: null,
					remark: null,
					default_worker_id: null,
					points: [],
					media_types: {}
				}
			},
			// 清空点位form数据
			resetPointForm() {
				this.pointForm = {
					building_area_id: null,
					media_type_id: null,
					code: null,
					pic_type_id: null,
					building_type: null,
					building_number: null,
					unit_number: null,
					floor: null,
					door_number: null,
					location: null,
					size_width: null,
					size_height: null,
					size_width_inside: null,
					size_height_inside: null,
					media_type_specs_id: null
				}
			},
			// 清空上传
			resetUploadForm() {
				this.newUploadForm = {
					fileName: '',
					building_area_id: null,
					type_id: null
				}
			},
			// 清空市场点位form数据
			resetDevicePointForm() {
				this.devicePointForm = {
					building_area_id: null,
					media_type_id: null,
					ab_type_id: null,
					code: null,
					pic_type_id: null,
					location: null,
					size_width: null,
					size_height: null,
					size_width_inside: null,
					size_height_inside: null,
					is_light: null,
					media_type_specs_id: null
				}
				this.$set(this.devicePointForm, 'bpoint', {
					building_area_id: null,
					media_type_id: null,
					ab_type_id: null,
					code: null,
					pic_type_id: null,
					location: null,
					size_width: null,
					size_height: null,
					size_width_inside: null,
					size_height_inside: null,
					is_light: null,
					media_type_specs_id: null
				})

			},
			resetBPointForm() {
				this.$set(this.devicePointForm, 'bpoint', {
					building_area_id: null,
					media_type_id: null,
					ab_type_id: null,
					code: null,
					pic_type_id: null,
					location: null,
					size_width: null,
					size_height: null,
					size_width_inside: null,
					size_height_inside: null,
					is_light: null,
					media_type_specs_id: null
				})
			},
			// 格式化媒体数据
			formatPointTypes(obj) {
				const that = this
				obj.points = []

				let keys = Object.keys(obj.media_types)
				if (keys && keys.length > 0) {
					for (let key of keys) {
						const count = parseInt(obj.media_types[key] || 0)
						let list = that.type_map.get(obj.type_id) || []
						if (count > 0 && list.indexOf(parseInt(key)) != -1) {
							obj.points.push({
								media_type_id: key,
								num: count
							})
						}
					}
				}
			},
			// 点位列表提交
			onCommonPointSubmit(type) {
				var obj
				if (type == 'common') {
					obj = this.commonPointList
				} else {
					obj = this.buildingPointList
				}
				if (obj == null || obj.length == 0) {
					Message.error('请先添加点位')
					return false
				}
				// 显示loading
				this.dialogPointLoading = true
				// 添加
				this.onPointAdd(obj)
			},
			onDevicePointSubmit() {
				var obj = this.devicePointList
				if (obj == null || obj.length == 0) {
					Message.error('请先添加点位')
					return false
				}
				// 查看是否存在重复code
				var map = new Map()
				var mapAB = new Map()
				var len = 0
				var len2 = 0
				obj.forEach(d => {
					map.set(d.code, d.code)
					mapAB.set(d.code.split('-')[0], d.code.split('-')[0])
					len++
					len2++
					if (d.bpoint.code != null && d.bpoint.code != undefined) {
						map.set(d.bpoint.code, d.bpoint.code)
						mapAB.set(d.bpoint.code.split('-')[0], d.bpoint.code.split('-')[0])
						len++
						len2++
					}
				})
				if (map.size != len) {
					Message.error('存在重复的编码！')
					return false
				}
				if (mapAB.size != len2) {
					Message.error('存在同一类型A面或B面，请重新检查！')
					return false
				}
				// 显示loading
				this.dialogPointLoading = true
				// 添加
				this.onPointAdd(obj)
			},
			onPointAdd(obj) {
				return pointAdd(obj)
					.then(res => {
						const {
							code,
							message
						} = res
						if (code === 200) {
							Message({
								message,
								type: 'success',
								duration: 1000
							})
							this.dialogCommonPoint = false
							this.dialogBuildingPoint = false
							this.dialogDevicePoint = false
							this.getList()
						}
						this.dialogPointLoading = false
					})
					.catch(() => {
						this.dialogPointLoading = false
					})
			},
			// 格式化Form
			formatFormData(obj) {
				if (obj.type_id != 78) {
					obj = Object.assign(obj, {
						price: null,
						scale: null,
						fix_sale_count_per_time: null,
						occupancy_rate: null,
						audience_ids: [],
						highest_floor: null,
						check_in_at: null
					})
				}
			},

			// 提交数据 增、改
			onSubmit(id) {
				// 表单校验
				this.$refs.cuForm.validate(valid => {
					// ~ 校验通过
					if (valid) {
						var obj = Object.assign({}, this.cuForm)

						delete obj.created_at
						delete obj.updated_at
						delete obj.deleted_at

						this.formatFormData(obj)

						this.formatPointTypes(obj)
						if (obj.management_fee != null && obj.management_fee != '') {
							if (obj.management_fee_unit_id == null || obj.management_fee_unit_id == '') {
								common.messageError('请选择物业费单位')
								return false
							}
						}
						if (obj.management_fee_unit_id != null && obj.management_fee_unit_id != '') {
							if (obj.management_fee == null || obj.management_fee == '') {
								common.messageError('请输入物业费')
								return false
							}
						}
						if ((obj.points || []).length == 0) {
							common.messageError('请输入点位数量')
							return false
						}

						// 显示loading
						this.dialogCULoading = true

						// ~~ 修改
						if (id) {
							this.onEdit(obj)
						} else {
							// ~~ 添加
							delete obj.id
							this.onAdd(obj)
						}
					} else {
						// ~ 不通过
						return false
					}
				})
			},
			// 添加
			onAdd(obj) {
				building_area_add(obj)
					.then(res => {
						const {
							code,
							message
						} = res
						if (code === 200) {
							common.message({
								message
							})
							this.dialogCU = false
							this.getList()
						}
						this.dialogCULoading = false

					})
					.catch(() => {
						this.dialogCULoading = false

					})
			},
			// 编辑
			onEdit(obj) {
				building_area_edit(obj)
					.then(res => {
						const {
							code,
							message
						} = res
						if (code === 200) {
							common.message({
								message
							})
							this.dialogCU = false
							this.getList()
						}
						this.dialogCULoading = false
					})
					.catch(() => {
						this.dialogCULoading = false
					})
			},
			// 删除
			async onDel(id) {
				const confirm = await common.confirmDialog('删除项目，将同时注销项目点位，您确定吗？');
				if(!!confirm) {
					building_area_del({
							id
						})
						.then(res => {
							const {
								code,
								message
							} = res
							if (code === 200) {
								common.message({
									message
								})
								this.getList()
							}
						})
				}
			}, // 重置搜索表单
			searchReset() {
				this.$refs.searchForm.resetFields()
				const params = this.$refs.searchForm.model
				this.listParams.media_type_spec_ids_str = null
				this.listParams = Object.assign(this.listParams, params)
				this.getList()
			},
			// 搜索
			searchSubmit(formName) {
				this.$refs[formName].validate(valid => {
					if (valid) {
						const params = this.$refs[formName].model
						this.listParams.media_type_spec_ids_str = params.media_type_spec_ids.join(',')
						this.listParams.page = 1
						this.current = 1
						this.listParams = Object.assign(this.listParams, params)
						this.getList()
					} else {
						console.log('error submit!!')
						return false
					}
				})
			},
			// 移除
			deleteRow(index, rows) {
				rows.splice(index, 1)
			},
			// 导出普通模板
			exportList() {
				window.open('https://meilai-test-2.oss-cn-hangzhou.aliyuncs.com/20220227181251783585.xlsx')
			},
			// 导出市场模板
			exportMarketList() {
				window.open('https://meilai-test-2.oss-cn-hangzhou.aliyuncs.com/20220315005927918632.xlsx')
			},
			// 上传模板
			submitFile(info) {
				this.newUploadForm.building_area_id = info.id
				this.newUploadForm.type_id = info.type_id
				this.dialogUploadFile = true
			},

			beforeUpload(file) { // 上传前 文件校验
				this.files = file
				const extension = file.name.split('.')[1] === 'xls'
				const extension2 = file.name.split('.')[1] === 'xlsx'
				const isLt2M = file.size / 1024 / 1024 < 2
				if (!extension && !extension2) {
					this.$message.warning('上传文件只能是 xls、xlsx格式!')
					return
				}
				// if (!isLt2M) {
				//   this.$message.warning('上传文件大小不能超过 2MB!')
				//   return
				// }
				this.fileName = file.name
				// 返回false不会自动上传
				// return false
			},

			beforeRemove() {
				this.files = null
			},

			submitUpload() { // 确认上传

				// return false
				if (this.files == null) {
					this.$message({
						message: '请上传要上传的文件！',
						type: 'warning',
						showClose: true
					})
					return false
				}

				let fileFormData = new FormData()
				fileFormData.append('file', this.files.raw) // 上传的文件
				fileFormData.append('building_area_id', this.newUploadForm.building_area_id)

				if (this.newUploadForm.type_id == 78 || this.newUploadForm.type_id == 82) {
					uploadABPoint(fileFormData).then(res => { // 上传请求
						if (res.code == 200) {
							Message.success('上传成功!')
							this.dialogUploadFile = false
						} else {
							Message.error('上传失败')
							return false
						}
					}).catch(err => {
						this.fileName = ''
						console.log('err')
					})
				} else {
					uploadPoint(fileFormData).then(res => { // 上传请求
						if (res.code == 200) {
							Message.success('上传成功!')
							this.dialogUploadFile = false
						} else {
							Message.error('上传失败')
							return false
						}
					}).catch(err => {
						this.fileName = ''
						console.log('err')
					})
				}
			},
			handleClose() {
				this.fileName = ''
				this.fileList = []
				this.files = null
				this.resetUploadForm()
				this.dialogUploadFile = false
			},

			// 表单多选
			handleSelectionChange(val) {
				this.selectRows = val
				this.selectIds = val.map(item => item.id)
			},
			// 分页 -pageSize改变
			handleSizeChange(val) {
				this.listParams.page_size = val
				this.getList()
			},
			// 分页 -pageNum改变
			handleCurrentChange(val) {
				this.listParams.page = val
				this.getList()
			},
			//带状态表格
			tableRowClassName({
				row
			}) {
				if (row.is_joined === 0) {
					return 'stop-row'
				}
				return ''
			},
			showSelectDateRange() {
				this.selectDateRangeVisible = true
				this.$nextTick(() => {
					this.$refs.cuFormTwo.clearValidate()
				})
			},
      showSelectWorker() {
        this.selectWorkerVisible = true
        this.$nextTick(() => {
          this.$refs.cuFormWorker.clearValidate()
        })
      },
      submitWorker(){
        this.$refs.cuFormWorker.validate(validate => {
            if (validate) {
              this.selectWorkerVisible = false
              const data = {
                worker_ids: this.cuFormWorker.worker_ids,
                building_ids: this.selectRows.map(d => d.id)
              }
              const loading = this.$loading({
                lock: true,
                text: '加载中',
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.6)'
              })

              assign_worker(data).then(() => {
                loading.close()
                this.$message.success('指派成功')
                this.getList()
              }).catch(() => {
                loading.close()
              })
            }
        })
      },
			exportExcel() {
				this.$refs.cuFormTwo.validate(validate => {
					if (validate) {
						const params = {
							startDate: this.cuFormTwo.date_range[0],
							endDate: this.cuFormTwo.date_range[1]
						}
						this.selectDateRangeVisible = false
						const loading = this.$loading({
							lock: true,
							text: '加载中',
							spinner: 'el-icon-loading',
							background: 'rgba(0, 0, 0, 0.6)'
						})
						export_leave_unused_point_excel(this.selectRows.map(d => d.id), params).then(() => {
							loading.close()
							this.$message.success('导出成功')
						}).catch(() => {
							loading.close()
						})
					}
				})
			},
			getMediaTypeAndSpecName() {
				allList().then(res => {
					this.mediaTypeSpecArr = res.data
				})
			},
			getMediaTypeSpecName(id) {
				let find = this.mediaTypeSpecArr.find(item => item.id == id)
				if (find !== undefined) {
					return '(' + find.name + ')'
				} else {
					return '(未标明规格)'
				}
			},
			/**
			 * 初始化颜色模式数组
			 */
			initColorModeArr() {
				list_all3rd_bycode({
					code: 'dwxg-ysms'
				}).then(res => {
					this.colorModeArr = res.data
				})
			},
			/**
			 * 初始化颜色位数数组
			 */
			initColorBitsArr() {
				list_all3rd_bycode({
					code: 'dwxg-ysmsws'
				}).then(res => {
					this.colorBitsArr = res.data
				})
			},
			/**
			 * 初始化视频格式数组
			 */
			initVideoFormatArr() {
				list_all3rd_bycode({
					code: 'dwxg-spgs'
				}).then(res => {
					this.videoFormatArr = res.data
				})
			},
			/**
			 * 初始化分辨率数组
			 */
			initResolvingPowerArr() {
				list_all3rd_bycode({
					code: 'dwxg-fbl'
				}).then(res => {
					this.resolvingPowerArr = res.data
				})
			},
			dialogCommonClose() {
				this.detailData.type_id = null
				this.commonForm = {
					id: null,
					code: null,
					pic_type_id: null,
					media_type_id: null,
					ab_type_id: null,
					building_area_id: null,
					building_type: null,
					building_number: null,
					unit_number: null,
					floor: null,
					door_number: null,
					location: null,
					size_width: null,
					size_height: null,
					size_width_inside: null,
					size_height_inside: null,
					is_light: null,
					media_type_specs_id: null,
					direction: null,
					resolving_power: null,
					resolving_power_value: null,
					color_mode: null,
					color_bits: null,
					opening_time: null,
					closing_time: null,
					video_format: null
				}
				this.$refs.commonForm.clearValidate()
			},
			onSubmitCommon() {
				this.$refs.commonForm.validate(flag => {
					if (flag) {
						const loading = this.$loading({
							lock: true,
							text: '提交中',
							spinner: 'el-icon-loading',
							background: 'rgba(0, 0, 0, 0.7)'
						})
						const arr = []
						arr.push(this.commonForm)
						pointAdd(arr).then(res => {
							if (res.code === 200) {
								this.dialogCommon = false
								this.$message.success('添加成功')
								this.getList()
							}
							loading.close()
						}).catch(() => {
							loading.close()
							this.$message.error('添加失败')
						})
					}
				})
			},
      exportBuildingMediaPoint(){
        const selectRows = this.selectRows
        var msg = '<div style="text-align: left"><p style="font-weight: 600">项目名称：</p>', idx=1, ids = []
        for(var i in selectRows){
          var o = selectRows[i]
          if(o.type_id==78 && o.media_types['1']) {
            msg += '<p style="color: teal">' + idx +'、' +  o.name +'</p>'
            ids.push(o.id)
            idx++
          }
        }
        msg += '<p>您确认要导出上刊点位明细？</p></div>'
        if(ids.length === 0) {
          this.$message.warning('请勾选分类是【小区】、媒体类型是【智能框】的项目')
          return false
        }
        this.$confirm(msg, '提示', {
          dangerouslyUseHTMLString: true,
          center:true,
          confirmButtonText: '导出',
        }).then(() => {
          const loading = this.$loading({
          	lock: true,
          	text: '加载中',
          	spinner: 'el-icon-loading',
          	background: 'rgba(0, 0, 0, 0.6)'
          })
          export_building_media_point_excel(ids).then(() => {
          	loading.close()
          	this.$message.success('导出成功')
          }).catch(() => {
          	loading.close()
          })
        }).catch(action => {});
      }
		}
	}
</script>

<style scoped lang="scss">
	.building-code-input {
		/deep/ .el-input__inner {
			padding-left: 5px !important;
			padding-right: 5px !important;
			text-align: center;
		}
	}

	.building-code-collapse.el-collapse {
		border-top: none;
	}
</style>
<style lang="scss" scoped>
	.app-container {
		.el-table {
			margin-top: 20px;

			.names-tag {
				box-sizing: border-box;
				margin: 3px;
			}

			/deep/ .stop-row {
				color: #bbb !important;
			}
		}
	}
</style>
<style lang="css" scoped>
	.upload-demo {
		display: inline-block !important;
		margin-left: 10px !important;
	}

	.demo-table-expand .el-form-item {
		/* margin-right: 0; */
		margin-bottom: 0;
		width: 50%;
	}
</style>
